﻿@model IEnumerable<BillBox.Models.User>
@{
    ViewBag.Title = "Users";
    Layout = "~/Views/Shared/_Layout.cshtml";    
}


<div class="row main">
    <div class="col-lg-12">
        <ol class="breadcrumb">
            <li>@Html.ActionLink("Home", "Index", "Default")</li>
            <li class="active">Users</li>
        </ol>
        <div class="panel panel-default">
            <div class="panel-heading">
                Users
            </div>
            <!-- /.panel-heading -->
            <div class="panel-body">
                <div class="table-responsive">
                    <table class="table  table-bordered table-striped table-hover">
                        <thead>
                            <tr>
                                <th>Name</th>
                                <th>Username</th>
                                <th>User Level</th>
                                <th>Agent</th>
                                <th>Branch</th>
                                <th>&nbsp;</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach (BillBox.Models.User user in Model)
                            {
                                <tr>
                                    <td>@user.Name</td>
                                    <td>@user.Username</td>
                                    <td>
                                        @if (@user.UserLevel != null)
                                        { @user.UserLevel.LevelName }
                                </td>
                                <td>
                                    @if (@user.Agent != null)
                                    { @user.Agent.Name }
                            </td>
                            <td>
                                @if (@user.AgentBranch != null)
                                { @user.AgentBranch.Name }
                        </td>
                        <td>
                            @Html.ActionLink("View", "Details", "User", new { id = @user.UserId }, null) |
                            @Html.ActionLink("Edit", "Edit", "User", new { id = @user.UserId }, null)
                        </td>
                    </tr>
                            }
                        </tbody>
                    </table>

                </div>
            </div>
            <!-- /.panel-body -->
            <div class="panel-footer">
                @Html.Partial("_Pager")
            </div>
        </div>
        <!-- /.panel -->
    </div>
    <!-- /.col-lg-12 -->
</div>
